package is.progetto2.gui;

import is.progetto2.activity.Activity;
import is.progetto2.activity.Job;

import javax.swing.table.AbstractTableModel;

public class JobTableModel extends AbstractTableModel {

	private static final long serialVersionUID = 1585964491137143324L;
	private Activity a;
	
	public JobTableModel(Activity a) {
		super();
		this.a = a;
	}

	@Override
	public String getColumnName(int arg0) {
		if(arg0==0){
			return "Id";
		}
		return "Durata";
	}

	@Override
	public int getColumnCount() {
		return 2;
	}

	@Override
	public int getRowCount() {
		return a.getJobSize();
	}

	@Override
	public Object getValueAt(int arg0, int arg1) {
		Job j=a.getJob(arg0);
		if(arg1==0){
			return j.getId();
		}
		return j.getDuration();
	}

}
